<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>房屋添加</title>
</head>
<link rel="stylesheet" href="/static/layui/css/layui.css" />
<body>
<form class="layui-form" action="" lay-filter="add">
    <div class="layui-form-item">
        <label class="layui-form-label">请输入所属地区:</label>
        <div class="layui-input-inline">
            <input type="tel" name="h_area" id="h_area" lay-verify="required" placeholder="请输入所属地区" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入所属小区：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_estate" id="h_estate"  required  lay-verify="required" placeholder="请输入所属小区" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入单元号：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_unitNumber" id="h_unitNumber"  required  lay-verify="required" placeholder="请输入单元号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入楼层：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_floor" id="h_floor"  required  lay-verify="required" placeholder="请输入楼层" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入房屋房间号：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_roomNo" id="h_roomNo"  required  lay-verify="required" placeholder="请输入房屋房间号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入房屋面积：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_acreaage" id="h_acreaage"  required  lay-verify="required" placeholder="请输入房屋面积" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入房屋朝向：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_direction" id="h_direction"  required  lay-verify="required" placeholder="请输入房屋朝向" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入房屋装修费用：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_fitment" id="h_fitment"  required  lay-verify="required" placeholder="请输入房屋装修费用" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否双气:</label>
        <div class="layui-input-block">
            <input type="radio" name="h_gas" value="1" title="是">
            <input type="radio" name="h_gas" value="0" title="否" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">请输入限住人数：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="h_people" id="h_people"  required  lay-verify="required" placeholder="请输入限住人数" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">出租价格：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="c_rental" id="c_rental"  required  lay-verify="required" placeholder="请输入出租价格" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
</body>
<script src="/static/js/jquery-3.3.1.js"></script>
<script src="/static/layui/layui.js"></script>
<script>

    layui.use(['form','laydate'], function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            var data1 = form.val("add");
            $.ajax({
                url:'/UserServlet?action=addHouse',
                type:"post",
                dataType:"json",
                data:data1,
                success:function (da) {
                    if (da.code == 200) {
                        layer.alert("添加成功！", function () {
                            parent.layer.closeAll();
                        });
                    } else {
                        layer.msg("添加失败！");
                    }
                }
            });
            return false;
        });

    });
</script>
</html>